package com.isoft.service.tableservice;

import com.isoft.dao.tabledao.DfmeFpttDao;
import com.isoft.entity.tableentity.dfme_fptt.DfmeFpttMsg;
import com.isoft.utils.TimeFormatUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.text.ParseException;

@Service
@Slf4j
public class DfmeFpttService {
    @Autowired
    DfmeFpttDao dfmeFpttDao;
    public int insertmsg(DfmeFpttMsg dfmeFpttMsg) throws ParseException {
        Timestamp create_time = new Timestamp(System.currentTimeMillis());
        Timestamp fptt= TimeFormatUtils.stringToTimestamp(dfmeFpttMsg.getDfmeFpttDflt().getFptt());
        Timestamp fplt= TimeFormatUtils.stringToTimestamp(dfmeFpttMsg.getDfmeFpttDflt().getFplt());
        dfmeFpttDao.insertMeta(create_time,dfmeFpttMsg.getDfmeFpttMeta());
        return  dfmeFpttDao.insertDflt(dfmeFpttMsg.getDfmeFpttMeta().getSeqn(),create_time,fptt,fplt,dfmeFpttMsg.getDfmeFpttDflt());
    }
}
